import types
class Demon:
    pass

d = Demon()
d.high = 'high'  # 实例对象添加属性
print(d.high)


Demon.name = 'tqq'  # 类对象添加属性
print(d.name)

# 动态添加方法 (实例绑定方法)
def dymacMethod(self):
    print('添加方法:',self.name)
    pass

d.bindMethod = types.MethodType(dymacMethod,d)
d.bindMethod()

# 绑定类方法
Demon.bindMethods  = dymacMethod
d.bindMethods()